import numpy as np
from matplotlib import pyplot as plt
import os
name='28.npy'# md随便选了几张结果连分割图都没有，倒霉
x1=r'data\image'
x2=r'data\edge'
x3=r'data\mask'
input=np.load(os.path.join(x1,name)) #4波段数据
edge=np.load(os.path.join(x2,name)) #边缘线分割图
mask=np.load(os.path.join(x3,name)) #地块分割图
print(input.shape)
rgb_image = input[:3,:, :]
rgb_image=rgb_image.transpose(1, 2, 0)
# 确保数据类型为float，并归一化到[0, 1]范围
rgb_image = rgb_image.astype(np.float32)  # 转换为float类型
if np.max(rgb_image) > 1:
    rgb_image /= 255.0  # 如果数据在[0, 255]范围内，归一化到[0, 1]

# 打印形状以确认
plt.imshow(rgb_image)
plt.axis('off')  # 关闭坐标轴
plt.title('RGB Image')
plt.show()